<template>
    <div class="notice-details h-100">
        <el-card class="box-card-details h-100" shadow="never">
            <div slot="header" class="clearfix">
                <div class="fl">
                    <span></span>
                    <h3 style="line-height:40px;">新闻公告</h3>
                </div>
                <div class="fr">
                    <el-button @click="goback"><i class="el-icon-back"></i>返回</el-button>
                </div>
            </div>
            <div class="notice-details-body">
                <header class="t-c">
                    <h2>{{noticenfo.AnsTitle}}</h2>
                    <p>{{noticenfo.AnsDate}}</p>
                </header>
                <article v-html="noticenfo.AnsContent"></article>
            </div>
        </el-card>
    </div>
</template>

<script>
import {getAnnouncementsmodel} from '@/api/index.js'

export default {
    name: 'noticedes',
    components: {
    },
    data() {
        return {
            noticenfo:{},
            bTaskID:'',
            bAnsID:''
        }
    },
    created(){
        // 获取要查看的id
        this.bAnsID = this.$route.query.bAnsID;
        this.bTaskID = this.$route.query.bTaskID;
        this.flag = this.$route.query.flag;
        if(this.bTaskID && this.bAnsID) {
            this._getstudyRehabilitationInfo();
        }
    },
    methods:{

        _getstudyRehabilitationInfo() {
            getAnnouncementsmodel({bAnsID:this.bAnsID,bTaskID:this.bTaskID}).then((res) => {
                if(res && res.length) {
                    console.log(res)
                    this.noticenfo = res[0];
                }
            }).catch((err) => {

            })
        },

        
        // 返回页面
        goback(){
            if(this.flag == '1') {
                this.$router.push({path:'/home/notice-list'})
            } else {
                this.$router.push({path:'home'})
            }
            
        },

    }
}
</script>
<style lang="less">
.notice-details{
    .box-card-details{
        box-sizing: border-box;
        .el-card__header{
            padding: 10px 20px;
            line-height: 40px;
        }
    }
    .notice-details-body{
        h2{
            margin-bottom: 20px;
            font-weight: 600;
        }
        header{
            margin-bottom: 20px;
            border-bottom: 1px solid #ccc;
            padding-bottom: 10px;
            p{
                color:#333;
            }
        }
    }
}
</style>
